<template>
  <el-dialog
    title="百融"
    :visible.sync="dialogVisible"
    width="700px"
    append-to-body
  >
    <div v-if="verification_data" class="pdf">
      <div class="top">
        <div class="top-title">审批报告</div>
        <div class="top-into">
          <div class="top-info-item">
            <div class="top-info-item-user">
              <div>姓名:{{ form.name }}</div>
              <div>手机号:{{ form.mobile }}</div>
              <div>身份证号:{{ form.id }}</div>
            </div>
          </div>
          <div class="top-info-item">
            <div class="top-info-item-user">
              <div>最终决策:{{ verification_data.InfoVerification.final_decision == 'Accept' ? '通过':verification_data.InfoVerification.final_decision == 'Reject' ? '拒绝': verification_data.InfoVerification.final_decision == 'Review' ? '复议':'无建议' }}</div>
              <div>验证规则:{{ verification_data.InfoVerification.final_weight }}</div>
              <div>反欺诈规则:{{ strategy_data.RiskStrategy.Rule.weight }}</div>
              <div>反欺诈评分:{{ strategy_data.RiskStrategy.ScoreAf.scoreafrevoloan }}</div>
              <div>信用评分:{{ strategy_data.RiskStrategy.Score.scoreconson }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="primary"
        @click="dialogVisible=false"
      >关闭</el-button>
      <el-button
        type="primary"
        @click="dialogVisible=false"
      >下载</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getRiskCredit } from '@/api/marketing'
// import { getTWCLog } from '@/api/aliPayTWC'
// import customPage from '@/components/customPage'
// import { twcInsuranceGet } from '@/api/aliPayTWC'
export default {
  // components: { customPage },
  props: ['orderId'],
  data() {
    return {
      dialogVisible: false,
      form: {
        id: '',
        name: '',
        mobile: ''
      },
      verification_data: null,
      strategy_data: null
    }
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.$nextTick(() => {
          this.getData()
        })
      }
    }
  },
  methods: {
    getData() {
      getRiskCredit({ order_id: this.orderId }).then(res => {
        if (res) {
          this.form.id = res.user_idcard
          this.form.name = res.user_name
          this.form.mobile = res.user_mobile
          this.verification_data = JSON.parse(res.verification_data)
          this.strategy_data = JSON.parse(res.strategy_data)
        }
        debugger
      })
    }
  }
}
</script>

<style scoped lang="scss">
.top{
  // border: 2px solid;
  // height:200px;
  .top-title{
    border: 1px solid;
    border-radius: 5px 5px 0 0;
    // background-color: rgb(68, 154, 231);
    // height: 40px;
    // font-size: 30px;
    color: black;
    text-align: center;
  }
  .top-into{
    border: 1px solid;
    display: flex;
    .top-info-item{
      width:50%;
      .top-info-item-user{
        margin: 10px;
      }
    }
  }
}
</style>
